﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Site.master" CodeBehind="BirthReport.aspx.cs"
    Inherits="CivilRegistry.BirthReport" %>

<%@ Register Src="~/UserControls/UCUserGadget.ascx" TagName="UserGadget" TagPrefix="UC" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="headerContent" ContentPlaceHolderID="HeadContent" runat="server">
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script type="text/javascript">

    function validatePage() {
        if (isNaN(parseFloat($('#<%=txtParentId.ClientID%>').val()))) {
            $('#<%=lblStatus.ClientID%>').text('Invalid UserId');
            return false;
        }
        return true;
    }

</script>
</asp:Content>
<asp:Content ID="maincontent" ContentPlaceHolderID="MainContent" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <center>
            <asp:Label ID="lblStatus" runat="server" BackColor="Yellow" ForeColor="DarkBlue"
                Font-Bold="true"></asp:Label>
        </center>
        <asp:Panel ID="panelAvailableBirthReports" runat="server">
            <div class="form-content" style="float: left;">
                <asp:Panel ID="pnlTools" runat="server">
                    <asp:Button ID="btnViewAll" runat="server" Text="View All" OnClick="btnViewAll_Click" CssClass="button greenButton medium"/>
                    <asp:Button ID="btnNewBirthReport" Text="New Birth-Report" runat="server" OnClick="btnNewBirthReport_Click"
                    CssClass="button greenButton medium" />
                </asp:Panel>
                <asp:GridView ID="gvBirthReport" runat="server" AllowPaging="true" AutoGenerateColumns="False"
                    CssClass="mGrid" PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt"
                    EmptyDataText="No records found!" AllowSorting="true" OnSorting="gvBirthReport_Sorting"
                    OnPageIndexChanging="gvBirthReport_PageIndexChanging" OnRowEditing="gvBirthReport_RowEditing"
                    BorderWidth="2px">
                    <HeaderStyle VerticalAlign="Top" BackColor="#003366" ForeColor="White" />
                    <RowStyle BackColor="White" ForeColor="Black" />
                    <Columns>
                        <asp:BoundField HeaderText="Parent Id" HeaderStyle-Width="25%" DataField="ParentId"
                            SortExpression="ParentId" />
                        <asp:BoundField HeaderText="Parent Name" HeaderStyle-Width="25%" DataField="ParentName"
                            SortExpression="ParentName" />
                        <asp:BoundField HeaderText="Gender Of Child" HeaderStyle-Width="25%" DataField="DOB"
                            SortExpression="DOB" />
                        <asp:BoundField HeaderText="Verification Code" HeaderStyle-Width="25%" DataField="VerificationCode" />
                    </Columns>
                </asp:GridView>
            </div>
        </asp:Panel>
        <asp:Panel ID="panelNewBirthReport" runat="server">
            <div>
                <div class="mainContent">
                    <asp:Panel ID="pnlPermanentAddressEdit" runat="server">
                        <div class="SideText">
                            Birth Report:
                        </div>
                        <div class="form-fields clearfix">
                            <div class="fl txtrgt divsize1">
                                <asp:Label ID="lblGender" runat="server" Text="Gender Of Child:"></asp:Label>
                            </div>
                            <div class="fr txtlft divsize2">
                                <asp:RadioButtonList ID="radioGender" runat="server" RepeatColumns="2" RepeatDirection="Horizontal">
                                    <asp:ListItem Text="Male" Value="M"></asp:ListItem>
                                    <asp:ListItem Text="Female" Value="F"></asp:ListItem>
                                </asp:RadioButtonList>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                                    ControlToValidate="radioGender" CssClass="redText" 
                                    ErrorMessage="Please specify the Gender of the child."></asp:RequiredFieldValidator>
                            </div>
                        </div>
                        <div class="form-fields clearfix">
                            <div class="fl txtrgt divsize1">
                                <asp:Label ID="lblParentId" runat="server" Text="Parent Id:"></asp:Label>
                            </div>
                            <div class="fr txtlft divsize2">
                                <asp:TextBox ID="txtParentId" runat="server"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please enter the Parent Id"
                                    CssClass="redText" ControlToValidate="txtParentId"></asp:RequiredFieldValidator>
                            </div>
                        </div>
                        <div class="form-fields clearfix">
                            <div class="fl txtrgt divsize1">
                                <asp:Label ID="lblDateOfBirth" runat="server" Text="Date Of Birth:"></asp:Label>
                            </div>
                            <div class="fr txtlft divsize2">
                                <asp:CalendarExtender ID="calendarExtdrDateOfBirth" TargetControlID="txtDateOfBirth"
                                    runat="server">
                                </asp:CalendarExtender>
                                <asp:TextBox ID="txtDateOfBirth" runat="server"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Please enter the Date Of Birth"
                                    CssClass="redText" ControlToValidate="txtDateOfBirth"></asp:RequiredFieldValidator>
                            </div>
                        </div>
                    </asp:Panel>
                </div>
                <div class="Gadget">
                    <center>
                        <asp:Image ID="imgBabyImage" runat="server" ImageUrl="~/Images/Baby.jpg" Height="188px"
                            Width="230px" />
                    </center>
                </div>
            </div>
            <div class="bottomButtons">
                <asp:Button ID="btnSave" Text="Save" runat="server" CssClass="button greenButton medium" OnClientClick="Page_ClientValidate(); return validatePage();"
                    OnClick="btnSave_Click" />
                <asp:Button ID="btnCancel" runat="server" Text="Cancel" CssClass="button red medium"
                    OnClick="btnCancel_Click" ValidationGroup="Different" />
            </div>
        </asp:Panel>
        <asp:Panel ID="pnlUserGadget" runat="server" CssClass="Gadget">
            <UC:UserGadget ID="ucUserGadget" runat="server" />
        </asp:Panel>
    </div>
</asp:Content>
